#-*- coding: utf-8 -*-
'''
Created on Aug 24, 2012

@author: bbg
'''

from sqlalchemy import Integer, Column, String, MetaData, Table, DateTime
from sqlalchemy.orm import mapper
    
class Cdkey(object):

    def __init__(self):
        self.cdkey = ''
        self.company_id = 0
        self.shop_id = 0
        self.state = 0
        self.valid_time = ''
        self.expire_time = ''
        self.uuid = ''
        
    @staticmethod
    def doMapping():
        metaData = MetaData()
        cdkeyTable = Table('cdkey', metaData,
                           Column('id', Integer, primary_key = True),
                           Column('cdkey', String),
                           Column('company_id', Integer),
                           Column('shop_id', Integer),
                           Column('state', Integer),
                           Column('valid_time', DateTime),
                           Column('expire_time', DateTime),
                           Column('uuid', String), schema="company_management")
        
        mapper(Cdkey, cdkeyTable)
        
    
# execute mapping
'''
默认做过mapper，后面使用不需要再进行mapper
'''
Cdkey.doMapping()